<template>
  <view class="yuongjin">
    <view class="manual" @click="redirect('/pages_promotion/member/manual')">
      <view class="img">
        <image src="https://runshui.oss-cn-shenzhen.aliyuncs.com/76b3a0cd2a941ec6931603c8360f311.png" mode="widthFix"></image>
      </view>
      <view style="flex: 1;">
        <view class="text1">2+1链动手册</view>
        <view class="text2">一周打造百人团队，多赚十万过大年</view>
      </view>
      <view class="btnSettlement">
        查看
      </view>
    </view>

    <view class="sum">
      <view class="sumItem">
        <view>{{ data.total_reward }}</view>
        <view>累计收益</view>
      </view>
      <view class="sumItem">
        <view>{{ data.balance }}</view>
        <view>可提现</view>
      </view>
      <view class="sumItem">
        <view>{{ data.success_withdrawal  }}</view>
        <view>已提现</view>
      </view>
      <view class="sumItem">
        <view>{{ data.wait_withdrawal }}</view>
        <view>提现中</view>
      </view>
    </view>

    <view class="settlementBtn" @click="redirect('/pages_promotion/member/settlement')">
      提现
    </view>

    <view class="module">
      <view class="title">常用功能</view>
      <view class="ability">
        <view class="item" @click="GOdetail">
          <u-image width="60rpx" height="60rpx" mode="widthFix" src="https://runshui.oss-cn-shenzhen.aliyuncs.com/b804ed396b249525d1afc2fc4ce0afd.png"></u-image>
          <view class="text">链动商品</view>
        </view>
        <view class="item" @click="redirect('/pages_promotion/member/team')">
          <u-image width="60rpx" height="60rpx" mode="widthFix" src="https://runshui.oss-cn-shenzhen.aliyuncs.com/5580f184b68dbbe26db098c9b0283e9.png"></u-image>
          <view class="text">我的团队</view>
        </view>
        <view class="item" @click="redirect('/pages_promotion/member/rewardList')"> 
          <u-image width="39rpx" height="60rpx" mode="widthFix" src="https://runshui.oss-cn-shenzhen.aliyuncs.com/5ffa64e6f9bb6e88c3d551c45dc8307.png"></u-image>
          <view class="text">奖励明细</view>
        </view>
      </view>
    </view>

    <view class="module" >
      <view class="title">隶属团队</view>
      <view class="ability1">
        <view class="item" >
          <view class="text">直属上级</view>
          <view class="name">{{ data.top1_name ? data.top1_name : '-' }}</view>
        </view>
        <view class="item" >
          <view class="text">链动上级</view>
          <view class="name">{{ data.top_name ? data.top_name : '-' }}</view>
        </view>
      </view>
    </view>

  </view>
</template>

<script>
export default {
  components: {
  },
  mixins: [],
  data() {
    return {
      page: 1,
      page_size: 10,
      data: {},
    }
  },
  onShow() {
    this.liandonginfo()
    this.$api.sendRequest({
      url: "/api/member/judgeBuy",
      success: res => {
        console.log(res,'/api/member/judgeBuy');
        if(!res.data){
          uni.hideShareMenu()
        }
      }
    });
  },
  onLoad(data) {
    
  },
  methods: {
    GOdetail(){
      this.$api.sendRequest({
        url: '/api/member/liandonggood',
        success: res => {
          console.log(res, 'this.data');
          this.$util.redirectTo('/pages/goods/detail', {
            goods_id: res.data.goods_id
          });
        }
      });
    },
    redirect(url){
      this.$util.redirectTo(url);
    },
    liandonginfo() {
      this.$api.sendRequest({
        url: '/api/member/liandonginfo',
        success: res => {
          this.data = res.data
          console.log(this.data, 'this.data');
        }
      });
    },
  },
  onShareTimeline() {
    return {
      title: '鹏城快享',
      query: `source_member=${uni.getStorageSync("user_id")}`,
      imageUrl: ""
    }
  },
  onShareAppMessage() {
    return {
      title: "鹏城快享",
      path: `/pages/index/index?source_member=${uni.getStorageSync("user_id")}`,
      imageUrl: ''
    }
  },
};
</script>

<style lang="scss" scoped>
@import '@/common/css/diy.scss';

.settlementBtn {
  background: #fe5e0a;
  color: #fff;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.module {
  padding: 15px 10px 15px 10px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 10px;

  .title {
    font-weight: bold;
    border-bottom: 4px solid #f8f8f8;
    padding-bottom: 12px;
  }

  .ability {
    display: flex;
    justify-content: space-around;

    .item {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      padding-top: 10px;
      height: 60px;

      .img {
        width: 30px;
        height: 30px;
      }

      .text {
        color: #666;
      }
    }

  }

  .ability1 {
    .item {
      display: flex;
      justify-content: space-between;
      padding: 20px 0;
      border-bottom: 2px solid #f8f8f8;
      .text {
        color: #666;
      }
      .name {
        color: #333333;
      }
    }
  }

}

.manual {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25rpx 20rpx;
  background: #333333;
  border: 1px solid #f4b904;
  border-radius: 10px;
  gap: 10px;
  margin-bottom: 10px;

  .img {
    width: 30px;
    height: 30px;
  }

  .text1 {
    font-weight: bold;
    color: #f2dcb7;
    font-size: 15px;
    margin-bottom: 10px;
  }

  .text2 {
    color: #f2dcb7;
    font-size: 12px;
  }

  .btnSettlement {
    background: #f5b909;
    padding: 5px 10px;
    border-radius: 10px;
  }
}

.member-code-popup .popup-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none !important;

}

.member-code-popup .popup-bottom .iconfont-delete {
  font-size: 48rpx;
  margin: 20rpx;
  // color: #fff;
}

.flex {
  display: flex;
}

.flex_1 {
  flex: 1;
}

.color1 {
  color: #666;
}

.color2 {
  color: #201003;
}

.flex_between {
  justify-content: space-between;
}

.flex_a_center {
  align-items: center;
}

.flex_a_end {
  align-items: flex-end;
}

.yuongjin {
  margin: 20rpx 30rpx;
  padding-bottom: 30px;

  .sum {
    background-color: #fff;
    padding: 30rpx 0;
    border-radius: 9px;
    display: flex;
    margin-bottom: 30rpx;

    .sumItem {
      flex: 1;
      text-align: center;

      &:nth-child(2) {
        border-right: 1px solid #fff;
        border-left: 1px solid #fff;
      }

      &>view {
        // color: #fff;
      }

      view:nth-child(1) {
        font-weight: bold;
        font-size: 18px;
        margin-bottom: 6px;
      }

      view:nth-child(2) {
        color: #666;
      }
    }
  }
}
</style>

<style scoped >
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
  background: none !important;
}

/deep/ .placeholder {
  height: 0;
}

/deep/::-webkit-scrollbar {
  width: 0;
  height: 0;
  background-color: transparent;
  display: none;
}

/deep/ .ns-copyright-info {
  margin-top: 40rpx;
  margin-bottom: 0;
}

.image-wrap {
  line-height: normal;
}

.image-wrap image {
  border-radius: 20rpx;
}
</style>